<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
  <head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>
      Extract Method Errors
    </title>
    <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
  </head>
  <body>
    <h1>
      Extract Method Errors
    </h1>
    <p>
      When you attempt to extract a method, you may get one or more of the following common errors:
    </p>
    <ul>
      <li>
        <code>Selected block references a local type declared outside the selection</code> A local type declaration is not part of the selection but is referenced by one of the
        statements selected for extraction. Either extend the selection that it includes the local type declaration or reduce the selection that no reference to the local type
        declaration is selected.<br>
      </li>
      <li>
        <code>A local type declared in the selected block is referenced outside the selection</code> The selection covers a local type declaration but the type is also referenced
        outside the selected statements. Either extend the selection that is includes all references to the local type or reduce the selection that the local type declaration
        isn't selected.<br>
      </li>
      <li>
        <code>Ambiguous return value: selected block contains more than one assignment to local variable</code> More than one assignment to a local variable was found inside the
        selected block. Either reduce the selection that only one assignment is selected or extend the selection that at least all reference except of one to the local variables
        are covered by the selection too.<br>
      </li>
      <li>
        <code>Ambiguous return value: expression access to local and return statement selected</code> The selected statement generates more than one return value. This is for
        example the case if an expression is selected and an expression's argument is modified as well. To remedy this problem extend the selection to cover the read access of
        the modified argument as well.<br>
      </li>
      <li>
        <code>Selection contains a break statement but the corresponding break target isn't selected</code> To remedy the problem either extend the selection to include the
        break / continue target or reduce the selection that the break / continue statement isn't covered by the selection.<br>
      </li>
      <li>
        <code>Selection contains a continue statement but the corresponding continue target isn't selected</code> To remedy the problem either extend the selection to include
        the break / continue target or reduce the selection that the break / continue statement isn't covered by the selection.<br>
      </li>
      <li>
        <code>Selection starts inside a comment</code> Parts of a comment cannot be extracted. Either extend the selection that it covers the whole comment or reduce the selection
        that the comment isn't covered at all.<br>
      </li>
      <li>
        <code>Selection ends inside a comment</code> Parts of a comment can't be extracted. Either extend the selection that it covers the whole comment or reduce the
        selection that the comment isn't covered at all.<br>
      </li>
      <li>
        <code>Cannot extract selection that ends in the middle of a statement</code> Adjust selection so 
        that it fully covers a set of statements or expressions. The users can extend the selection to 
        a valid range using the <strong>Expand Selection to</strong> in the <a href="ref-menu-edit.htm">Edit menu.</a><br>
      </li>
    </ul>
    <h3 class="related">Related concepts</h3> 
      <a href="../concepts/concept-jdt.htm">Java development tools (JDT)</a><br>
      <a href="../concepts/concept-refactoring.htm">Refactoring support</a>
    <h3 class="related">Related references</h3>
      <a href="ref-menu-source.htm">Source menu</a><br>
      <a href="ref-menu-refactor.htm">Refactor menu</a>
  </body>
</html>

